package com.jubaozan.framework.sentinel.springmvc.config;

import com.alibaba.csp.sentinel.datasource.redis.config.RedisConnectionConfig;
import com.jubaozan.framework.sentinel.config.ApplicationRedisValueConfig;
import com.jubaozan.framework.sentinel.constant.RuleKeyConstant;
import javax.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author jiangjinwu
 * @version 1.0
 * @since 2025/7/23 13:51
 */

@Slf4j

public class BaseRedisDataSource {
    private   ApplicationRedisValueConfig applicationRedisValueConfig;
    protected    RuleKeyConstant ruleKeyConstant;
    protected RedisConnectionConfig config;

    protected String channel = "sentinel.rules.flow.channel";

    public BaseRedisDataSource(ApplicationRedisValueConfig applicationRedisValueConfig,RuleKeyConstant ruleKeyConstant){
        this.ruleKeyConstant = ruleKeyConstant;
        config = RedisConnectionConfig.builder()
            .withHost(applicationRedisValueConfig.getHost())
            .withPort(applicationRedisValueConfig.getPort())
            .withPassword(applicationRedisValueConfig.getPassword())
            .build();
    }

}
